<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>CS334: Windows Programming</title></head><body>

<center><h3>
                CS334 - Program 6 (20 points)
                <br>
                Due 11 PM, Thursday, April 19
</h3></center>

        Create a VB program that can be used to create a quiz and also for students to 
        take the quiz. You will use UserControl and Interface in your program.
            The solution has two projects: project MyControls and project UserProg.

<h4> Project MyControls </h4>
        The project defines three UserControls for three types of questions: TrueFalse, 
        MultiChoice, and Comment, and an interface IQuestion that will be implemented 
        by the three user controls. A MultiChoice question has exactly 4 possible 
        choices. The project also defines an enumeration type QuestionMode.

<h5> The GUI of the three UserControls </h5>
     <ol>
     <li> UserControl TrueFalse
          <ul>
          <li> Size: (700, 120) </li>
          <li> Controls
               <ul>
               <li> label lblIndex: location (8, 24), size (48, 16)</li>
               <li> textbox txtQuestion: location (64, 24), size (560, 20)</li>
               <li> two radiobuttons optTrue and optFalse: location (130, 70)/(380, 70), size (104, 24) </li>
               </ul>
               </li>
           </ul> </li>
      <li> UserControl MultiChoice
           <ul>
           <li> Size: (700, 180)  </li>
           <li> Controls
                <ul>
                <li> label lblIndex: location (8, 24), size (48, 16)</li>
                <li> textbox txtQuestion: location (64, 24), size (560, 20)</li>
                <li> four (4) radiobuttons </li>
                <li> four (4) choice textboxes </li>
                </ul>
                </li>
            </ul> </li>
      <li> UserControl Comment
           <ul>
           <li> Size: (700, 190) </li>
           <li> Controls
                <ul>
                <li> label lblIndex: location (8, 24), size (48, 16)</li>
                <li> textbox txtQuestion: location (64, 24), size (560, 20)</li>
                <li> textbox txtComment: location (64, 64), size (560, 90), MultipleLine True </li>
                </ul>
                </li>
           </ul></li>
        </ol> 
        
<h5> The enumeration type</h5>
<pre>'The enumeration type is used by the interface
Public Enum QuestionMode
    Creating
    Taking
End Enum
</pre>

<h5> The interface </h5>
All methods are required. 
<pre>Public Interface IQuestion

   ' The height of the control
   ReadOnly Property height() As Integer

   ' Displays a question at point Pos of theForm and 
   '     then increases the height of theForm by the height of the control.
   ' When theMode is Creating
   '     TextBox for the question should be Read/Write
   '     Key should be displayed
   '     Choice textboxes of MultiCHoice class should be Read/Write
   '     txtComment of Comment class should be ReadOnly
   ' When theMode is Taking
   '     TextBox for the question should be ReadOnly
   '     Key should NOT be displayed
   '     Choice textboxes for MultiCHoice class should be ReadOnly
   '     txtComment for Comment class should be Read/Write
   ' Set a private field _mode to theMode
   Sub Display(ByVal Pos As Point, ByVal theForm As Form, ByVal theMode As QuestionMode)

   ' Removes the question from theForm and then
   '     decreases the height of theForm by the height of the control.
   Sub Remove(ByVal theForm As Form)

   ' Checks if the question is completed and throws an exception if not completed.
   ' Saves the key for TrueFalse and MultiChoice.
   Sub Save()

   ' Sets or Reads the question index, which can be stored as the Text of lblIndex.
   Property Index() As Integer

   ' Returns 1 if correct, 0 otherwise (including no answer)
   ' For Comment, returns 1 if answer is not null string, 0 otherwise 
   Function Score() As Integer

   ' Any part of the question changed, excluding the index. 
   ' Raised when creating or editing the question.
   Event Changed()

End Interface
</pre>

<h5> You <u>must use private methods</u>
        in the three UserControl classes to implement the interface.</h5>

<h5> The assembly name must be <b>Question</b> and the root spacename must be <b>UWPCS3340</b>.</h5>


<h4> Project UserProg </h4>
<ol>
<li> The project should have one module, which defines an ArrayList or any other collection to
     store the questions of a quizz. </li>
<li> There are three forms: frmStart, frmCreate and frmQuiz. Your forms should look 
            similar to the forms of the sample program and behave in the same way. The 
            title of all forms is "Prog 6" followed by your name. </li>
<li> At the beginning, frmStart is displayed. The form has four buttons: cmdCreate, 
                cmdEdit, cmdTake and cmeExit.
     <ul>
     <li> Clicking on button cmdCreate will display frmCreate and clear the current quiz 
                    if one exists, and the user can create a new quiz. </li>
     <li> Clicking on button cmdEdit will also display frmCreate. If a quiz exists, the 
                    quiz will not be cleared and the user can edit the quiz. The first question of 
                    the quiz should be shown on the form. </li>
     <li> Clicking on button cmdTake will show frmQuiz. If a quiz exists, then all 
                    questions of the quiz are displayed on the form. </li>
     <li> Clicking on button cmdExit will terminate the program.</li>
     </ul> </li>
<li> Using frmCreate, you can create a new quiz or edit the current quiz. The form displayes one question
      at a time if the current quiz has one or more questions. 
      The form has eight command buttons and three radiobuttons.
     <ul>
     <li> The form minimum size is (800, 200). </li>
     <li> At the beginning when creating a new quiz, only cmdNew and cmdBack are enabled,
          and type TrueFalse is selected. </li>
     <li> Clicking on cmdNew will display a new question whose type is determined by the 
                    selcted radiobutton. The new question will also be added to the end of the quiz ArrayList. </li>
     <li> The buttons cmdSave and cmdRemove will be enabled after a new question is displayed,
          and buttons cmdBack and cmdNew will be disabled. </li>
     <li> Clicking on cmdSave will save the current question.  But if the question is not completed, the 
                    question object will throw an exception, and the user program should catch it
                    and display a message. </li>
     <li> After a question is saved successfully, the saved question remains the current question. 
                    The button cmdSave will be disabled, and cmdNew, cmdRemove, and cmdBack are enabled.  </li>
     <li> Clicking on cmdRemove will remove the current question. The question will be removed from both
                    the form and the quiz ArraList. </li>
     <li> After a question is removed, the next question or the last question becomes the 
                    current question and is displayed if available. </li>
     <li> There are two navigation buttons cmdPrevious and cmdNext that will show the 
                        previous and next question of the quiz. </li>
     <li> There are also two buttons cmdUp and cmdDown that will move the current quetion in the quiz ArraList up and 
                        down by one position. The indexes of both questions involved should also be modified.
                    </li>
     <li> All buttons should be enabled and disabled when appropriate. 
                    For example, after a question is saved, cmdPrevious and cmdUp are enabled if 
                    there is at least another question in the quiz ArraList; after moving to the previous 
                    question, cmdDown and cmdNext will be enabled, and cmdPrevious and cmdUp may 
                    become disabled. </li>
     <li>The question index label should always display the correct number. </li>
     <li> The uer can modify a question after it's saved. Whenever the question is modified, except when the position and index
                    is changed, both buttons cmdSave and cmdRemove will be enabled and other buttons will be disabled.
                    This can be done by creating a sub to handle the Changed event of IQuestion.  </li>
     <li> Clicking on cmdBack will return the program to frmStart. </li>
     </ul> </li>
<li> Using frmQuiz, the user can take the current quiz and get the score.
     <ul>
     <li> The form minimum size is (800, 200). </li>
     <li> All questions in the current quiz will be displayed in the correct order and 
                    all answers should be cleared. </li>
     <li> Clicking on button cmdSubmit will show a message box with the score even when 
                    the quiz is not completed. The user can change the answers and submit again. </li>
     <li> The height of the form will increase to display all the questions, but form 
                        height never go above 650. </li>
     <li> A quiz can be taken multiple times. Every time the quiz is taken, all questions should be displayed 
            the same as the first time, and all answers should be cleared. </li>
     <li> Whenever the form is shown, it should be in the center of the screen. </li>
     </ul></li>
<li> On all three forms, you <b>must not</b> use IF or Select to choose the type of questions, except when creating
     new questions. </li>     
</ol>

<h4>Submission </h4>
<ol>
<li> You must do the program in pairs, and you must have a different partner from previous programs. </li>
<li> You must sign a pairing sheet by 11 PM, Thursday, April 12. 
     <b>Otherwise, you will lose two points.</b> </li>
<li> Use your UserName to name the solution folder. </li>
<li> Drop your solution folder to folder Prog6 of the class DROP folder by 11 PM, Thursday, April 19, 2007. </li>
<li> You must send an email to the instructor by 11 PM, Thursday, April 19, 2007.
     <br> 
     Answer the following three questions in the email (1 is the lowest score and 5 is the highest score):
     <ol>
     <li> What do you think of your partner's programming skill? (1 to 5) </li>
     <li> What do you think of your partner's contribution to the program? (1 to 5) </li>
     <li> Do you want to work with your partner in the future? (1 to 5) </li>
     </ol>
     </li>
<li> You may lose up to two points for incorrect submission, including missing email and incorrect folder name. </li>
<li> You must follow the programming rules, and you may lose up to 2 points on style. </li>
</ol>


</body></html>